.floating-button {
  z-index: 9999;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  transition: left 0.18s ease, top 0.18s ease; /* 松手吸附时的平滑过渡 */
  
  .floating-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    cursor: grab;
    transition: all 0.3s ease;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
    
    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
    }
    
    &:active {
      transform: translateY(0);
    }
    
    .floating-btn-icon {
      font-size: 24px;
      filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
    }
  }
  
  &.active .floating-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 20px rgba(240, 147, 251, 0.4);
    
    &:hover {
      box-shadow: 0 6px 25px rgba(240, 147, 251, 0.6);
    }
  }
  
  &.dragging .floating-btn {
    cursor: grabbing;
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.8);
    z-index: 10000;
  }
  
  /* 拖拽过程中禁用容器过渡，避免跟手感差 */
  &.dragging {
    transition: none;
  }
  
  .system-overlay-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    min-width: 140px;
    animation: fadeInUp 0.2s ease-out;
    
    .overlay-option {
      display: block;
      width: 100%;
      padding: 12px 16px;
      margin: 4px 0;
      background: transparent;
      border: none;
      border-radius: 8px;
      font-size: 14px;
      cursor: pointer;
      transition: all 0.2s ease;
      
      &:hover {
        background: rgba(102, 126, 234, 0.1);
      }
      
      &.cancel {
        color: #666;
        
        &:hover {
          background: rgba(255, 0, 0, 0.1);
        }
      }
    }
  }
}

/* 当系统悬浮窗已开启时，弱化应用内按钮，避免重复感和误触 */
.floating-button.system-overlay-active {
  .floating-btn {
    opacity: 0.35;
    filter: grayscale(0.2);
    pointer-events: none;
    box-shadow: none;
    transform: none;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 移动端适配 */
@media (max-width: 768px) {
  .floating-button {
    bottom: 100px;
    right: 16px;
    
    .floating-btn {
      width: 48px;
      height: 48px;
      
      .floating-btn-icon {
        font-size: 20px;
      }
    }
  }
}

/* 安全区域适配 */
@supports (padding: max(0px)) {
  .floating-button {
    bottom: max(80px, env(safe-area-inset-bottom) + 20px);
    right: max(20px, env(safe-area-inset-right) + 20px);
  }
  
  @media (max-width: 768px) {
    .floating-button {
      bottom: max(100px, env(safe-area-inset-bottom) + 40px);
      right: max(16px, env(safe-area-inset-right) + 16px);
    }
  }
}
